<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@include file="/common/definition.jsp"%>

<html:html>
<tiles:insert beanName="admin-definition" flush="true">
	<tiles:put name="title"> Administrator Management </tiles:put>
	<tiles:put name="body" type="string">
		<div class="row">
			<div class="col-md-2"></div>
			<div class="col-md-6">
				<s:form action="addProduct" enctype="multipart/form-data"
					theme="simple">
					<div class="form-group">
						<h1>Add Product</h1>
					</div>
					<div class="form-group">
						<s:property value="errorAddProduct" />
					</div>
					<div class="form-group">
						<label>Product Name</label>

						<s:textfield name="productName" cssClass="form-control" />
					</div>
					<div class="form-group">
						<label><strong>Danh Mục:</strong> </label> <select
							class="form-control" name="catID" id="catID">
							<option value=0>Chọn Danh Mục</option>
							<s:iterator value="productModel.listSubcat" id="list">
								<s:iterator value="listinfo">
									<option value='<s:property value="catID"/>'>
										<s:property value="catName" />
									</option>
								</s:iterator>
							</s:iterator>
							<s:iterator value="listSubcat" id="list">
								<s:iterator value="listinfo">
									<option value='<s:property value="catID"/>'>
										<s:property value="catName" />
									</option>
								</s:iterator>
							</s:iterator>
						</select>
					</div>
					<div class="form-group">
						<label><strong>Nhà Sản Xuất:</strong> </label> <select
							class="form-control" tabindex="1" name="brandID" id="brandID">
							<option value=0>Chọn Nhà Sản Xuất</option>
							<s:if test="productModel.listBrandInfo != null">
								<s:iterator value="productModel.listBrandInfo">
									<option value='<s:property value="brandID"/>'>
										<s:property value="brandName" />
									</option>
								</s:iterator>
							</s:if>
							<s:if test="listBrandInfo != null">
								<s:iterator value="listBrandInfo">
									<option value='<s:property value="brandID"/>'>
										<s:property value="brandName" />
									</option>
								</s:iterator>
							</s:if>
						</select>
					</div>
					<div class="form-group">
						<s:file name="imgUpload" />
					</div>
					<div class="form-group">
						<s:file name="imgUpload" />
					</div>
					<div class="form-group">
						<s:file name="imgUpload" />
					</div>
					<div class="form-group">
						<s:file name="imgUpload" />
					</div>
					<div class="form-group">
						<s:file name="imgUpload" />
					</div>
					<div class="form-group pull-right">
						<button Class="btn btn-primary">Add</button>
						<button type="reset" class="btn btn-default">Clear</button>
					</div>

				</s:form>
			</div>
		</div>
		<script>
			function validPicture() {
				var file = document.getElementById('fileUpload');
				var ext = file.value.match(/\.(.+)$/)[1];
				switch (ext) {
				case 'xlsx':
					break;
				case 'xls':
					break;
				default:
					jquery_alert('Warning',
							'Chỉ được upload các file dữ liệu theo template được cung cấp( link kế bên).');
					file.value = '';
					return;
				}
				var fileSize = file.files[0].size;
				if (fileSize != null && fileSize > 1048576) {
					jquery_alert('Warning',
							'Dung lượng file ảnh phải < 1Mb(1048576 Bytes)')
					file.value = '';
					return;
				}
			};
		</script>
	</tiles:put>
</tiles:insert>
</html:html>
